<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head></h:head>

<h:body>
	<div id="logoHomePage" align="left">
		<a href="../homepage.xhtml"><img src="../grafica/MeteoCal_Logo.gif" width="150" height="50"/></a>
	</div>
	
	<div id="logout" align="right">
   		<h:form>
			<h:commandButton action="#{logoutBean.logout}" value="Logout" />
		</h:form>
	</div>
	
	<p:panel>

		<h:form>
		<p:panel header="Notification">
			<h:panelGrid columns="3" id="notificationGrid">
				
				<p:dataTable value="#{invitationBean.result2}" var="result2">  		        			
		        	<p:column headerText="Select event"> 
		       			#{result2.name}
		        	</p:column>
		        	<p:column headerText="">
		       			<p:commandButton value="Select" action="#{invitationBean.selectEvent(result2.eventid,result2.name)}" />
		        	</p:column>
		   		</p:dataTable>
				
				<p:dataTable value="#{invitationBean.result}" var="result">  		        			
		        	<p:column headerText="Select users to invite"> 
		       			#{result.name} #{result.surname}  
		        	</p:column>
		        	<p:column headerText="invite">
		       			<p:commandButton value="Invite" action="#{invitationBean.addUser(result.email)}" />
		        	</p:column>
		   		</p:dataTable>
				
			</h:panelGrid>
			<p:commandButton value="Load my events" update="notificationGrid" action="#{invitationBean.findMyEvents()}" />
			<p:commandButton value="Load users" update="notificationGrid" action="#{invitationBean.findAllUsers()}" />
			<p:commandButton value="Submit invitations" action="#{invitationBean.createInvitation()}" />

		</p:panel>
		<div align="right"><h:link outcome="personal" value="Go to personal page" /></div>
	</h:form>
	
	</p:panel>    
	

	</h:body>
</html>
